package com.example.dy.pay.service;

import com.example.dy.pay.domain.PaymentInfo;
import lombok.Data;
import org.example.dayu521.OrderState;

import java.util.Map;

public interface BasePayService {

    private <T> T t(){
        throw new RuntimeException("未实现");
    }

    // 返回值: 是否能够成功关闭
    default OrderState close_order(PaymentInfo paymentInfo){
        throw new RuntimeException("未实现");
    }
    //返回值: 状态是否可以确定
    default OrderState poll_trade(PaymentInfo paymentInfo){
        throw new RuntimeException("未实现");
    }

    //有此交易的情况下,进行退款,否则什么都不做
    default void refund(String order,String svc){
        throw new RuntimeException("未实现");
    }

    @Data
    final class PayAck<T>{
        private T reply;
        private PaymentInfo paymentInfo;
    }
    default PayAck<?> pay(Map<String,String> p, String svc){ return t();}
}
